ActionController::Routing::Routes.draw do |map|
  # The priority is based upon order of creation: first created -> highest priority.   
 
  map.resources :chats, :singular => "chat", 
         :member => {:crear_mensaje => :post, :mostrar_mensajes => :post, :comprobar_actualizar_estado => :post, 
                    :rechazar_solicitud => :get}, :collection => {:solicitar_chat => :get, :notificar_nuevo_chat => :post}
  map.resources :paises, :singular => 'pais'
  map.resources :baneos, :plantillas, :tipo_regalos, :citas, :recordatorios
  map.resources :regalos, :collection =>{:invitacion => :post, :create_prueba => :post, :nuevo => :get }, 
                :member => { :update_prueba => :put }, :name_prefix => "prueba_" do |regalo|
      regalo.resources :mensajes, :collection => { :create_prueba => :post }, :name_prefix => "prueba_"
  end

  map.resources :tipo_celebraciones, :singular => 'tipo_celebracion'

  map.resource :main, :controller => 'main', :member => { :acceso => :get }

  map.resources :usuarios do |usuario|
    usuario.resource :perfil, :controller => 'perfiles', :path_prefix => '/:usuario'
    usuario.resources :amigos, :singular => 'amigo', :controller => 'amistades', :path_prefix => '/:usuario',
              :collection => { :peticion => :post , :live_search => :post, :buscar => :get, :resultados => :any, :cumpleanios => :get },
              :member => { :publico => :get, :recordar => :post }
    usuario.resource :home, :controller => 'home', :member => {:ocultarse => :post, :actualizar_conectados => :post, :actualizar_eventos => :post, 
                                        :admin => :get}, :path_prefix => '/:usuario'                                        
    usuario.resources :regalos, :singular => 'regalo', :collection => { :enviados => :get, :recibidos => :get, 
                      :nuevo => :get, :r => :get, :d => :get }, :new => { :prueba => :post }, :member => {:aviso => :get},  
                      :path_prefix => '/:usuario' do |regalo|
      regalo.resources :mensajes, :name_prefix => 'regalo_'    
    end    
    usuario.resources :celebraciones, :singular => 'celebracion', :path_prefix => '/:usuario'
  end
            
  map.open_id_complete 'cuentas', :controller => "cuentas", :action => "create", :requirements => { :method => :get }
  map.resources :cuentas, :collection => { :begin => :post, :complete => :get }

  map.activate '/activate/:activation_code', :controller => 'usuarios', :action => 'activate'

  map.registro '/registro', :controller => 'usuarios', :action => 'new'
  map.acerca '/acerca', :controller => "main", :action => 'acerca'
  map.contacto '/contacto', :controller => "main", :action => 'contacto'
  map.condiciones '/condiciones', :controller => "main", :action => 'condiciones' 
  map.compromiso '/compromiso', :controller => "main", :action => 'compromiso' 
  map.login  '/login',  :controller => 'cuentas', :action => 'new'
  map.logout '/logout', :controller => 'cuentas', :action => 'destroy'
  map.forgot_password '/forgot_password', :controller => 'cuentas', :action => 'forgot_password'
  map.reset_password '/reset_password/:id', :controller => 'cuentas', :action => 'reset_password'
  # map.change_password '/change_password', :controller => 'cuentas', :action => 'change_password'  
  


  map.main '', :controller => 'main'

  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'


  # Install the default routes as the lowest priority.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end
